import yaml
import os

defaultMineruConfig = {
  "ip":"127.0.0.1",
  "port":8080
}

def getMineruConfig():
  # 获取脚本所在目录的绝对路径
  script_dir = os.path.dirname(os.path.abspath(__file__))
  config_path = os.path.join(script_dir, 'mineru_config.yaml')

  try:
      with open(config_path, 'r') as f:
        config = yaml.safe_load(f)
      return config
  except FileNotFoundError:
      print("配置文件不存在，使用默认配置")
      return defaultMineruConfig

if __name__ == "__main__":
    print(getMineruConfig())
